<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /**
     * 变量声明let
     * 1. 变量不能重复声明
     * 2. 块作用域：全局，函数，eval
     * 3. 不存在变量提升
     */
    let let_name = "Jason"

    /**
     * 常量声明const
     * 1. 常量一定要赋值
     * 2. 常量一般大写
     * 3. 常量不能修改
     * 4. 块作用域
     * 5. 对于数组和对象的元素修改，不算对常量的修改
     */
    const TIME = "2023-06-24"
    const arr = [1, 2, 3, 4, 5, 6]
    arr.push(23)

    /**
     * 解构赋值：按照一定的模式提取数组或对象中的值，并对变量进行赋值
     */
    // 数组的解构赋值
    const names = ['Jason', 'Jackson', 'Jack', 'Black']
    let [name1, name2, name3, name4] = names;
    let testName1 = function () {
        console.log(name1)
    }
    // 对象的解构赋值
    const student = {
        name: 'Jason',
        age: 21,
        sayHello: function (name) {
            console.log("hello,", name)
        }
    }
    let {name, age, sayHello} = student;
    let testObject = function () {
        console.log(name)
        console.log(age)
        sayHello("Jackson Black")
    }
</script>
</body>
</html>